package web.servlets;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Objects;

public class PasswordRepeatServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String password = req.getParameter("password");
        String repeatedPassword = req.getParameter("repeatedPassword");
        //System.out.println(password);
       // System.out.println(repeatedPassword);
        resp.setContentType("text/plain");
        PrintWriter out = resp.getWriter();
        if (Objects.equals(password, repeatedPassword)) {
            out.print("OK");
           // System.out.println("ok");
        } else {
            out.print("Error");
            //System.out.println("error");
        }
        out.flush();
        out.close();
    }
}
